package com._bytecode.__jdk_proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

/**
 * @author huangya
 * @date 2022/1/6
 */
public class AAAA {

    public static void main(String[] args) {
        InvocationHandler invocationHandler = new InvocationHandler() {
            Object target;

            public void InvocationHandler(Object target) {
                this.target = target;
            }

            @Override
            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                Object object = method.invoke(target, args);
                return object;
            }
        };
        IPurchaser proxyInstance = (IPurchaser) Proxy.newProxyInstance(IPurchaser.class.getClassLoader(), new Class[]{IPurchaser.class}, invocationHandler);
    }
}
